<!-- 收藏详情 -->
<template>
  <div id="CollectionDetails">
    <!-- 头部 -->
    <Head BackType1="1" title="收藏详情" NoticeType2='1' v-on:PointClick="PointClick"></Head>
    <div id="CollectionDetailsMain">
      <div class="NameBox">
        <img :src="pic" alt="404">
        <div class="Name">{{name}}</div>
      </div>
      <div class="CollectionDetailsDetails">
        <img v-show="hasimg" :src="content" alt="404">
        <div v-show="!hasimg">{{content}}</div>
      </div>
      <div class="CollectionDetailsTime">收藏于  今天</div>
    </div>
    <van-actionsheet
      v-model="show"
      :actions="actions"
      cancel-text="取消"
      @select="onSelect"
      @cancel="onCancel"
    />
  </div>
</template>

<script>
  import Head from "../components/Head"
  import { Actionsheet } from 'vant';
  import { Dialog } from 'vant';
  
  export default {
    data(){
      return{
        pic:'',
        name:'',
        content:'',
        hasimg:true,
        show: false,
        actions:[
          {name:'转发'},
          {name:'删除'},
        ]
      }
    },
    components:{
        Head,
        [Actionsheet.name]:Actionsheet,
        [Dialog.name]:Dialog
    },
    mounted(){
      /**
      * 收藏详情
      */
      var buid={
        buid:parseInt(this.$route.query.buid)
      }
      console.log(buid)
      this.$get(urlConfig.collectionDetail,buid)
      .then(res => {
        console.log(res);
        this.pic = res.data.buser.pic
        this.name = res.data.buser.nickname
        if(res.data.type == 1){
          this.hasimg = false
          this.content = res.data.content
        }else{
          this.content = res.data.content
        }
      })
    },
    methods:{
      PointClick(){
        this.show= true
      },
      onSelect(item){
        let name = item.name
        console.log(item.name)
        if(name == '转发'){
          
        }else if(name == '删除'){
          Dialog.confirm({
            title: '提示',
            message: '你确定删除该条收藏吗？'
            
          }).then(() => {
            this.$router.push({path:'Collection',query:
            {
              name:'进入详情'
            }})
          }).catch(() => {
            this.show = false;
          });
        }
      },
      onCancel(){
        console.log(3)
      }
    }
  }
</script>

<style lang="less" scoped>
  #CollectionDetails{
    .van-actionsheet__item:nth-child(2){
      color: #F36059;
    }
    #CollectionDetailsMain{
      position: fixed;
      top:88px;
      left: 0;
      overflow: scroll;
      bottom: 0;
      .NameBox{
        display: flex;
        flex-direction: row;
        padding: 0 30px;
        img{
          width: 80px;
          height: 80px;
          border-radius: 40px;
          background: #fff;
          margin-top: 20px;
        }
        .Name{
          display: block;
          padding-left: 20px;
          padding-top: 30px;
          font-size: 30px;
          line-height: 50px;
        }
      }
      .CollectionDetailsDetails{
        width: 690px;
        padding: 10px 30px;
        margin: 20px 0;
        background: #fff;
        min-height:300px;
        img{
          width: 100%;
          height: auto;
        }
        div{

          text-align: left;
          line-height: 40px;
          font-size: 28px;
        }
      }
      .CollectionDetailsTime{
        width: 690px;
        padding: 0 30px;
        color: #999;
        font-size: 30px;
      }
    }
  }
</style>